﻿Public Class Form1
    Dim negrita As Boolean = False
    Dim cursiva As Boolean = False
    Dim subrayado As Boolean = False
    Dim negritaf As FontStyle
    Dim cursivaf As FontStyle
    Dim subrayadof As FontStyle

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        negrita = Not negrita
        If negrita Then
            negritaf = FontStyle.Bold
        Else
            negritaf = FontStyle.Regular
        End If
        Actualiza()
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        cursiva = Not cursiva
        If cursiva Then
            cursivaf = FontStyle.Italic
        Else
            cursivaf = FontStyle.Regular
        End If
        Actualiza()
    End Sub

    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
        subrayado = Not subrayado
        If subrayado Then
            subrayadof = FontStyle.Underline
        Else
            subrayadof = FontStyle.Regular
        End If
        Actualiza()
    End Sub

    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
        CheckBox1.Checked = False
        CheckBox2.Checked = False
        CheckBox3.Checked = False
        Me.TextBox1.Font = New System.Drawing.Font(TextBox1().Font, FontStyle.Regular)

    End Sub

    Public Sub Actualiza()
        CheckBox4.Checked = False
        Me.TextBox1.Font = New System.Drawing.Font("Arial", 18.0!, CType(((negritaf Or cursivaf) Or subrayadof), System.Drawing.FontStyle))
    End Sub
End Class
